# 柱形图
# 1.单柱形图
# import pandas as pd
# import matplotlib.pyplot as plt
# df = pd.read_excel('某公司各部门1—2月份实际支出.xlsx')
# x = df['部门']
# height = df['1月']
# plt.figure(figsize=(8,4))
# plt.rcParams['font.sans-serif'] = 'SimHei'
# plt.title('某公司各部门1月份实际支出单柱形图')
# plt.ylabel('实际支出（元）')
# for a,b in zip(x,height):
#     plt.text(a,b,'%d' % b,ha='center')
# plt.bar(x,height,0.4,color='teal')
# plt.legend(('1月'))
# plt.show()

# 2.簇状柱形图
# import numpy as np
# import pandas as pd
# import matplotlib.pyplot as plt
# df = pd.read_excel('某公司各部门1—2月份实际支出.xlsx')
# plt.figure(figsize=(8,4))
# plt.rcParams['font.sans-serif'] = 'SimHei'
# plt.title('某公司各部门1—2月份实际支出簇状柱形图')
# plt.ylabel('实际支出（元）')
# x_data = np.arange(len(df['部门']))
# height_data = [ ]
# height_data.append(df['1月'])
# height_data.append(df['2月'])
# width = 0.4
# for i in range(len(height_data)):
#     x = x_data + i * width
#     height = height_data[i]
#     plt.bar(x,height,width)
#     for a,b in zip(x,height):
#         plt.text(a,b,'%d' % b,ha='center')
# plt.xticks(x_data + 0.2,df['部门'])
# plt.legend(('1月','2月'))
# plt.show()

# 3.堆积柱形图
# import pandas as pd
# import matplotlib.pyplot as plt
# df = pd.read_excel('某公司各部门1—2月份实际支出.xlsx')
# x = df['部门']
# height = df['1月']
# plt.figure(figsize=(8,4))
# plt.rcParams['font.sans-serif'] = 'SimHei'
# plt.title('某公司各部门1—2月份实际支出堆积柱形图')
# plt.ylabel('实际支出（元）')
# width = 0.4
# plt.bar(x,df['1月'],width,color='green')
# plt.bar(x,df['2月'],width,bottom=df['1月'],color='salmon')
# for a,b,c in zip(x,df['1月'],df['2月']):
#     plt.text(a,b / 2,'%d' % b,ha='center',va='center')
# plt.text(a,b + c / 2,'%d' % c,ha='center',va='center')
# plt.legend(('1月','2月'))
# plt.show()

# 4.条形图
# import pandas as pd
# import matplotlib.pyplot as plt
# import seaborn as sns
# df = pd.read_excel('某公司产品销售数据.xlsx')
# plt.figure(figsize=(8,4))
# sns.set_style(style='ticks',rc={'font.sans-serif':'SimHei'})
# sns.set_palette(sns.color_palette('husl',8))
# sns.barplot(x='销售额（万元）',y='季度',hue='地区',data=df,orient='ha')
# ax = plt.gca()
# for p in ax.containers:
#     ax.bar_label(container=p,label_type='edge')
# plt.title('某公司各季度不同地区产品销售额簇状条形图')
# plt.show()

# 5.雷达图
# from pyecharts import options as opts
# from pyecharts.charts import Radar
# from pyecharts.globals import ThemeType
# radar = Radar(init_opts=opts.InitOpts(width='600px',height='400px',theme=ThemeType.ESSOS,page_title='雷达图'))
# radar.add(series_name='某员工',data=[[90,60,75,85,95]],linestyle_opts=opts.LineStyleOpts(color='red'))
# radar.add_schema(schema=[opts.RadarIndicatorItem(name='管理能力',max_=100),
#                          opts.RadarIndicatorItem(name='业务能力',max_=100),
#                          opts.RadarIndicatorItem(name='组织能力',max_=100),
#                          opts.RadarIndicatorItem(name='沟通能力',max_=100),
#                          opts.RadarIndicatorItem(name='表达能力',max_=100),
#                          ],
#                  center=['50%','60%'],
#                  splitline_opt=opts.SplitLineOpts(is_show=True,
#                         linestyle_opts=opts.LineStyleOpts(color='grey')),
#                  textstyle_opts=opts.TextStyleOpts(color='black'),
#                  )
# radar.set_global_opts(
#     title_opts=opts.TitleOpts(
#         title='某员工能力分析雷达图',pos_left='center'),
#     legend_opts=opts.LegendOpts(pos_right='35',pos_top='25'))
# radar.render('例3-5.html')